/*
 * Phys2D - a 2D physics engine based on the work of Erin Catto.
 * 
 * This source is provided under the terms of the BSD License.
 * 
 * Copyright (c) 2006, Phys2D
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or 
 * without modification, are permitted provided that the following 
 * conditions are met:
 * 
 *  * Redistributions of source code must retain the above 
 *    copyright notice, this list of conditions and the 
 *    following disclaimer.
 *  * Redistributions in binary form must reproduce the above 
 *    copyright notice, this list of conditions and the following 
 *    disclaimer in the documentation and/or other materials provided 
 *    with the distribution.
 *  * Neither the name of the Phys2D/New Dawn Software nor the names of 
 *    its contributors may be used to endorse or promote products 
 *    derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 
 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 
 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
 * OF SUCH DAMAGE.
 */
package net.phys2d.raw.shapes;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.GeneralPath;
import java.awt.geom.Line2D;

import net.phys2d.math.Vector2f;

/**
 * Super class of generic shapes in the engine
 * 
 * @author Kevin Glass
 */
public strictfp abstract class PAbstractShape implements PhysShape {
	/** The circular bounds that fit the shape based on the position of the body */
	protected AABox bounds;
	protected GeneralPath path;
	protected String name;
	
	/**
	 * Construct a new shape as subclas swhich will specified it's
	 * own bounds
	 */
	protected PAbstractShape() {
		name = "UnNamed";
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	/**
	 * Create a shape
	 * 
	 * @param bounds The bounds of the shape
	 */
	public PAbstractShape(AABox bounds) {
		this.bounds = bounds;
	}
	
	/**
	 * @see net.phys2d.raw.shapes.PhysShape#getBounds()
	 */
	public AABox getBounds() {
		return bounds;
	}
	
	public void draw(Graphics2D g, Vector2f pos, float rot) {
		g.draw(getGeneralPath(pos,rot));
	}
	
	public GeneralPath getGeneralPath(Vector2f position, float rot) {
		path = new GeneralPath();

//		Line2D.Float l = new Line2D.Float();
//		
//		Vector2f v = new Vector2f(position);
//		l.setLine(v.x,v.y,v.x + Math.cos(rot)*10,v.y + Math.sin(rot)*10);
//		
//		path.append(l,true);
		
		//path.moveTo(position.x, position.y);
		//path.lineTo(position.x, position.y + 10);
		return path;
	}
}
